#include<bits/stdc++.h>
using namespace std;
int n,o,sum,cnt,cnt1,v[70000],l,r;
struct w
{
	int x,y,z;
}a[20000];
signed main()
{
	freopen("road.in","r",stdin);
	freopen("road.out","w",stdout);
	scanf("%d",&n); o = sum = 1;
	cnt = 2;
	cnt1++;a[cnt1].x = cnt,a[cnt1].y = 114,a[cnt1].z = 1;
	cnt1++;a[cnt1].x = cnt,a[cnt1].y = 114,a[cnt1].z = 0;
	v[1] = cnt;
	while(sum+o <= n)
	{
		o *= 2;
		if(sum+o <= n)
		{
			sum += o;
			cnt1++;a[cnt1].x = cnt+1,a[cnt1].y = cnt,a[cnt1].z = o;
			cnt1++;a[cnt1].x = cnt+1,a[cnt1].y = cnt,a[cnt1].z = 0;
			cnt++;
			v[sum] = cnt;
		}
	}
	l = sum+1; r = sum;
	while(r)
	{
		while(l+r<=n)
		{
			cnt1++;a[cnt1].x = cnt,a[cnt1].y = v[r],a[cnt1].z = l;
			l += r+1;
		}
		r /= 2;
	}
	while(l <= n) cnt1++,a[cnt1].x = cnt,a[cnt1].y = 114,a[cnt1].z = l,l++;
	printf("%d %d\n",cnt+1,cnt1);
	for(int i = 1;i <= cnt1;i++) 
	{
		if(a[i].x == cnt) a[i].x = 1;
		if(a[i].y == cnt) a[i].y = 1;
		printf("%d %d %d\n",a[i].x,a[i].y,a[i].z);
	}
	return 0;
}

 
